<!DOCTYPE html>
<html lang="en">
  <head>
    <title>
        Java-tool-Maven-1 - rulerLwx Blog
      </title>
        <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
      content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no, minimal-ui">
    <meta name="renderer" content="webkit">
    <meta http-equiv="Cache-Control" content="no-transform" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="format-detection" content="telephone=no,email=no,adress=no">
    
    <meta name="theme-color" content="#000000" />
    
    <meta http-equiv="window-target" content="_top" />
    
    
    <meta name="description" content="Maven最佳配置 将M2_HOME/config/setting.xml复制到~/.m2/setting.xml（最佳实战） 设置MAVEN_" />
    <meta name="generator" content="Hugo 0.73.0 with theme pure" />
    <title>Java-tool-Maven-1 - rulerLwx Blog</title>
    
    
    <link rel="stylesheet" href="https://rulerLwx.gitee.io/css/style.min.c4bc7071f132c964c2116bca53b392933f377e5ca7b7051ed245187c621a2d3e.css">
    
    <link rel="stylesheet" href="https://cdn.staticfile.org/highlight.js/9.15.10/styles/github.min.css" async>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/tocbot/4.4.2/tocbot.css" async>
    <meta property="og:title" content="Java-tool-Maven-1" />
<meta property="og:description" content="Maven最佳配置 将M2_HOME/config/setting.xml复制到~/.m2/setting.xml（最佳实战） 设置MAVEN_" />
<meta property="og:type" content="article" />
<meta property="og:url" content="https://rulerLwx.gitee.io/2020/07/java-tool-maven-1/" />
<meta property="article:published_time" content="2020-07-01T18:58:47+08:00" />
<meta property="article:modified_time" content="2020-07-01T18:58:47+08:00" />
<meta itemprop="name" content="Java-tool-Maven-1">
<meta itemprop="description" content="Maven最佳配置 将M2_HOME/config/setting.xml复制到~/.m2/setting.xml（最佳实战） 设置MAVEN_">
<meta itemprop="datePublished" content="2020-07-01T18:58:47&#43;08:00" />
<meta itemprop="dateModified" content="2020-07-01T18:58:47&#43;08:00" />
<meta itemprop="wordCount" content="4660">



<meta itemprop="keywords" content="" /><meta name="twitter:card" content="summary"/>
<meta name="twitter:title" content="Java-tool-Maven-1"/>
<meta name="twitter:description" content="Maven最佳配置 将M2_HOME/config/setting.xml复制到~/.m2/setting.xml（最佳实战） 设置MAVEN_"/>

    <!--[if lte IE 9]>
        <script src="https://cdnjs.cloudflare.com/ajax/libs/classlist/1.1.20170427/classList.min.js"></script>
      <![endif]-->

    <!--[if lt IE 9]>
        <script src="https://cdn.jsdelivr.net/npm/html5shiv@3.7.3/dist/html5shiv.min.js"></script>
        <script src="https://cdn.jsdelivr.net/npm/respond.js@1.4.2/dest/respond.min.js"></script>
      <![endif]-->
  </head>

  
  

  <body class="main-center theme-black" itemscope itemtype="http://schema.org/WebPage"><header class="header" itemscope itemtype="http://schema.org/WPHeader">
    <div class="slimContent">
      <div class="navbar-header">
        <div class="profile-block text-center">
          <a id="avatar" href="https://gitee.com/rulerLwx" target="_blank">
            <img class="img-circle img-rotate" src="https://rulerLwx.gitee.io/avatar.png" width="200" height="200">
          </a>
          <h2 id="name" class="hidden-xs hidden-sm">rulerLwx</h2>
          <h3 id="title" class="hidden-xs hidden-sm hidden-md">thinking...</h3>
          <small id="location" class="text-muted hidden-xs hidden-sm"><i class="icon icon-map-marker"></i>Guangzhou, China</small>
        </div><div class="search" id="search-form-wrap">
    <form class="search-form sidebar-form">
        <div class="input-group">
            <input type="text" class="search-form-input form-control" placeholder="Search" />
            <span class="input-group-btn">
                <button type="submit" class="search-form-submit btn btn-flat" onclick="return false;"><i
                        class="icon icon-search"></i></button>
            </span>
        </div>
        <div class="ins-search">
            <div class="ins-search-mask"></div>
            <div class="ins-search-container">
                <div class="ins-input-wrapper">
                    <input type="text" class="ins-search-input" placeholder="Type something..."
                        x-webkit-speech />
                    <button type="button" class="close ins-close ins-selectable" data-dismiss="modal"
                        aria-label="Close"><span aria-hidden="true">×</span></button>
                </div>
                <div class="ins-section-wrapper">
                    <div class="ins-section-container"></div>
                </div>
            </div>
        </div>
    </form>
</div>
        <button class="navbar-toggle collapsed" type="button" data-toggle="collapse" data-target="#main-navbar" aria-controls="main-navbar" aria-expanded="false">
          <span class="sr-only">Toggle navigation</span>
          <span class="icon-bar"></span>
          <span class="icon-bar"></span>
          <span class="icon-bar"></span>
        </button>
      </div>
      <nav id="main-navbar" class="collapse navbar-collapse" itemscope itemtype="http://schema.org/SiteNavigationElement" role="navigation">
        <ul class="nav navbar-nav main-nav">
            <li class="menu-item menu-item-home">
                <a href="/">
                    <i class="icon icon-home-fill"></i>
                  <span class="menu-title">Home</span>
                </a>
            </li>
            <li class="menu-item menu-item-archives">
                <a href="/posts/">
                    <i class="icon icon-archives-fill"></i>
                  <span class="menu-title">Archives</span>
                </a>
            </li>
            <li class="menu-item menu-item-categories">
                <a href="/categories/">
                    <i class="icon icon-folder"></i>
                  <span class="menu-title">Categories</span>
                </a>
            </li>
            <li class="menu-item menu-item-tags">
                <a href="/tags/">
                    <i class="icon icon-tags"></i>
                  <span class="menu-title">Tags</span>
                </a>
            </li>
            <li class="menu-item menu-item-about">
                <a href="/about/">
                    <i class="icon icon-cup-fill"></i>
                  <span class="menu-title">About</span>
                </a>
            </li>
        </ul>
      </nav>
    </div>
  </header>

<aside class="sidebar" itemscope itemtype="http://schema.org/WPSideBar">
  <div class="slimContent">
    
      <div class="widget">
    <h3 class="widget-title">Board</h3>
    <div class="widget-body">
        <div id="board">
            <div class="content">enjoy~
            </div>
        </div>
    </div>
</div>

      <div class="widget">
    <h3 class="widget-title"> Categories</h3>
    <div class="widget-body">
        <ul class="category-list">
            <li class="category-list-item"><a href="https://rulerLwx.gitee.io/categories/java-framework/" class="category-list-link">java-framework</a><span class="category-list-count">38</span></li>
            <li class="category-list-item"><a href="https://rulerLwx.gitee.io/categories/java-front-end/" class="category-list-link">java-front-end</a><span class="category-list-count">11</span></li>
            <li class="category-list-item"><a href="https://rulerLwx.gitee.io/categories/java-se/" class="category-list-link">java-se</a><span class="category-list-count">21</span></li>
            <li class="category-list-item"><a href="https://rulerLwx.gitee.io/categories/java-senior/" class="category-list-link">java-senior</a><span class="category-list-count">4</span></li>
            <li class="category-list-item"><a href="https://rulerLwx.gitee.io/categories/linux/" class="category-list-link">linux</a><span class="category-list-count">13</span></li>
            <li class="category-list-item"><a href="https://rulerLwx.gitee.io/categories/tools/" class="category-list-link">tools</a><span class="category-list-count">1</span></li>
            <li class="category-list-item"><a href="https://rulerLwx.gitee.io/categories/%E6%8A%80%E6%9C%AF%E6%9D%82%E7%83%A9/" class="category-list-link">技术杂烩</a><span class="category-list-count">4</span></li>
            <li class="category-list-item"><a href="https://rulerLwx.gitee.io/categories/%E6%95%B0%E6%8D%AE%E5%BA%93/" class="category-list-link">数据库</a><span class="category-list-count">15</span></li>
        </ul>
    </div>
</div>
      <div class="widget">
    <h3 class="widget-title"> Tags</h3>
    <div class="widget-body">
        <ul class="tag-list">
            
            
            <li class="tag-list-item"><a href="https://rulerLwx.gitee.io/tags/jvm/" class="tag-list-link">jvm</a><span
                    class="tag-list-count">1</span></li>
            
            
            <li class="tag-list-item"><a href="https://rulerLwx.gitee.io/tags/%E5%A4%9A%E7%BA%BF%E7%A8%8B/" class="tag-list-link">多线程</a><span
                    class="tag-list-count">2</span></li>
            
            
            <li class="tag-list-item"><a href="https://rulerLwx.gitee.io/tags/%E7%BD%91%E7%BB%9C%E7%BC%96%E7%A8%8B/" class="tag-list-link">网络编程</a><span
                    class="tag-list-count">3</span></li>
            
        </ul>

    </div>
</div>
      
<div class="widget">
    <h3 class="widget-title">Recent Posts</h3>
    <div class="widget-body">
        <ul class="recent-post-list list-unstyled no-thumbnail">
            <li>
                <div class="item-inner">
                    <p class="item-title">
                        <a href="https://rulerLwx.gitee.io/2020/07/%E8%87%AA%E5%B7%B1%E5%8A%A8%E6%89%8B%E4%B8%80%E6%89%B9%E9%87%8F%E7%A7%BB%E5%8A%A8%E9%87%8D%E5%91%BD%E5%90%8D%E6%96%87%E4%BB%B6/" class="title">自己动手（一）——批量移动、重命名文件</a>
                    </p>
                    <p class="item-date">
                        <time datetime="2020-07-27 17:50:02 &#43;0800 CST" itemprop="datePublished">2020-07-27</time>
                    </p>
                </div>
            </li>
            <li>
                <div class="item-inner">
                    <p class="item-title">
                        <a href="https://rulerLwx.gitee.io/2020/07/%E5%85%B3%E4%BA%8Einteger%E7%9A%84-128~127%E7%BC%93%E5%AD%98/" class="title">关于Integer的 -128~127缓存</a>
                    </p>
                    <p class="item-date">
                        <time datetime="2020-07-11 16:56:21 &#43;0800 CST" itemprop="datePublished">2020-07-11</time>
                    </p>
                </div>
            </li>
            <li>
                <div class="item-inner">
                    <p class="item-title">
                        <a href="https://rulerLwx.gitee.io/2020/07/%E8%B7%A8%E5%9F%9F%E9%97%AE%E9%A2%98/" class="title">跨域问题</a>
                    </p>
                    <p class="item-date">
                        <time datetime="2020-07-08 22:41:12 &#43;0800 CST" itemprop="datePublished">2020-07-08</time>
                    </p>
                </div>
            </li>
            <li>
                <div class="item-inner">
                    <p class="item-title">
                        <a href="https://rulerLwx.gitee.io/2020/07/%E4%B8%AA%E4%BA%BA%E5%8D%9A%E5%AE%A2%E6%90%AD%E5%BB%BA/" class="title">个人博客搭建</a>
                    </p>
                    <p class="item-date">
                        <time datetime="2020-07-05 18:58:47 &#43;0800 CST" itemprop="datePublished">2020-07-05</time>
                    </p>
                </div>
            </li>
            <li>
                <div class="item-inner">
                    <p class="item-title">
                        <a href="https://rulerLwx.gitee.io/2020/07/centos/" class="title">CentOS-</a>
                    </p>
                    <p class="item-date">
                        <time datetime="2020-07-01 18:58:47 &#43;0800 CST" itemprop="datePublished">2020-07-01</time>
                    </p>
                </div>
            </li>
        </ul>
    </div>
</div>
  </div>
</aside>

    
    
<aside class="sidebar sidebar-toc collapse" id="collapseToc" itemscope itemtype="http://schema.org/WPSideBar">
  <div class="slimContent">
    <h4 class="toc-title">Catalogue</h4>
    <nav id="toc" class="js-toc toc">

    </nav>
  </div>
</aside>
<main class="main" role="main"><div class="content">
  <article id="-" class="article article-type-" itemscope
    itemtype="http://schema.org/BlogPosting">
    
    <div class="article-header">
      <h1 itemprop="name">
  <a
    class="article-title"
    href="/2020/07/java-tool-maven-1/"
    >Java-tool-Maven-1</a
  >
</h1>

      <div class="article-meta">
        
<span class="article-date">
  <i class="icon icon-calendar-check"></i>&nbsp;
<a href="https://rulerLwx.gitee.io/2020/07/java-tool-maven-1/" class="article-date">
  <time datetime="2020-07-01 18:58:47 &#43;0800 CST" itemprop="datePublished">2020-07-01</time>
</a>
</span>
<span class="article-category">
  <i class="icon icon-folder"></i>&nbsp;
  <a class="article-category-link" href="/categories/java-framework/"> Java-framework </a>
</span>

        <span class="post-comment"><i class="icon icon-comment"></i>&nbsp;<a href="/2020/07/java-tool-maven-1/#comments"
            class="article-comment-link">Comments</a></span>
		<span class="post-wordcount hidden-xs" itemprop="wordCount">Word Count: 4660words</span>
		<span class="post-readcount hidden-xs" itemprop="timeRequired">Read Count: 10minutes </span>
      </div>
    </div>
    <div class="article-entry marked-body js-toc-content" itemprop="articleBody">
      <h1 id="maven最佳配置">Maven最佳配置</h1>
<ul>
<li>将M2_HOME/config/setting.xml复制到~/.m2/setting.xml（最佳实战）</li>
<li>设置MAVEN_OPTS环境变量，值为 -Xms128m -Xmx512m ，（因生成项目站点时需要大量的内存）TODO&hellip;</li>
<li>不使用IDE内嵌的Maven</li>
</ul>
<h1 id="配置依赖">配置依赖</h1>
<h2 id="xml标签基本概念">xml标签——基本概念</h2>
<ul>
<li>groupId</li>
<li>artifactId</li>
<li>version</li>
<li>type，依赖类型（jar、war、pom、bundle），默认为jar。</li>
<li>scope，依赖范围，默认compile。</li>
<li>optional，标记依赖是否可选。</li>
<li>exclusions，用来排除传递性依赖。</li>
</ul>
<p>下图是依赖范围（scope）：
<img src="https://oscimg.oschina.net/oscnet/95b5baa6a88baff55ac75cf7d88bbb5f27f.jpg" alt="dependent-scope" title="dependent-scope"></p>
<p><img src="https://oscimg.oschina.net/oscnet/7b31f892a114a2b4af267394ad7e89208b5.jpg" alt="maven的传递性依赖" title="maven的传递性依赖"></p>
<h2 id="依赖最佳实践">依赖最佳实践</h2>
<ul>
<li>排除不稳定的依赖，使用<code>exclusions</code>元素，如下</li>
</ul>
<pre><code class="language-xml">    &lt;dependency&gt;
        &lt;groupId&gt;xxxx&lt;/groupId&gt;
        &lt;artifactId&gt;xxx&lt;/artifactId&gt;
        &lt;version&gt;0.9.1.2&lt;/version&gt;
        &lt;exclusions&gt;
            &lt;exclusion&gt;
                &lt;groupId&gt;&lt;/groupId&gt;
                &lt;artifactId&gt;&lt;/artifactId&gt;
            &lt;/exclusion&gt;
        &lt;/exclusions&gt;
    &lt;/dependency&gt;
</code></pre>
<ul>
<li>归类依赖</li>
</ul>
<p>也就是统一定义版本</p>
<pre><code class="language-xml">    &lt;properties&gt;
        &lt;mybatis.version&gt;3.2.4&lt;/mybatis.version&gt;
    &lt;/properties&gt;
    &lt;dependencies&gt;
        &lt;dependency&gt;
            &lt;groupId&gt;org.springframework&lt;/groupId&gt;
            &lt;artifactId&gt;spring-core&lt;/artifactId&gt;
            &lt;version&gt;${spring.version}&lt;/version&gt;
        &lt;/dependency&gt;
    &lt;/dependencies&gt;
</code></pre>
<h1 id="仓库本地远程中央仓库">仓库：本地、远程、中央仓库</h1>
<p>仓库分类：
<img src="https://oscimg.oschina.net/oscnet/a5919292f7d5125db3c046e21d1b6bcc2bc.jpg" alt="maven-repo-catalog" title="maven-repo-catalog"></p>
<ul>
<li>本地仓库</li>
</ul>
<p>本地仓库默认在C:\Users\lwx.m2\repository（windows),/home/xxx/.m2/repository(linux)
可以在setting.xml文件中修改仓库位置：</p>
<pre><code class="language-xml">&lt;settings&gt;
    &lt;localRepository&gt;D:\java\maven\repo&lt;/localRepository&gt;
&lt;/settings&gt;
</code></pre>
<ul>
<li>远程仓库</li>
</ul>
<p>经常用于配置公司的公用仓库</p>
<pre><code class="language-xml">&lt;project&gt;
    ....
    &lt;repositories&gt;
        &lt;repository&gt;
            &lt;id&gt;xxx&lt;/id&gt;
            &lt;name&gt;xxx&lt;/name&gt;
            &lt;url&gt;http://xxx.xxx&lt;/url&gt;
            &lt;releases&gt;
                &lt;enabled&gt;true&lt;/enabled&gt;
            &lt;/releases&gt;
            &lt;snapshots&gt;
                &lt;enabled&gt;false&lt;/enabled&gt;
            &lt;/snapshots&gt;
            &lt;layout&gt;default&lt;/layout&gt;
        &lt;/repository&gt;
    &lt;/repositories&gt;
&lt;/project&gt;
</code></pre>
<p>仓库（repository子元素）可以配置一个或多个；</p>
<p>releases &gt; enabled 表示是否开启仓库的发布版本下载支持；snapshots &gt; enable 表示是否下载快照版本。</p>
<ul>
<li>
<p>仓库搜索服务</p>
<ul>
<li>Sonatype Nexus:<a href="https://repository.sonatype.org">https://repository.sonatype.org</a></li>
<li>MVNrepository:<a href="http://mvnrepository.com/">http://mvnrepository.com/</a></li>
<li>search.maven:<a href="http://search.maven.org/">http://search.maven.org/</a></li>
</ul>
</li>
</ul>
<h1 id="maven生命周期清理初始化编译测试打包集成测试验证部署站点">Maven生命周期：清理、初始化、编译、测试、打包、集成测试、验证、部署、站点</h1>
<p>maven的生命周期包括：清理、初始化、编译、测试、打包、集成测试、验证、部署、站点。</p>
<p>maven拥有三套相互独立的生命周期，分别是：</p>
<ul>
<li>clean，清理项目
<ul>
<li>pre-clean 执行一些清理前需要完成的工作</li>
<li>clean 清理上一次构建生成的文件</li>
<li>post-clean 执行一些清理后需要完成的工作</li>
</ul>
</li>
<li>default，构建项目
<ul>
<li>validate</li>
<li>initialize</li>
<li>generate-sources</li>
<li>process-sources</li>
<li>generate-resources</li>
<li>process-resources</li>
<li>compile  编译主代码到主输出目录</li>
<li>process-class</li>
<li>generate-test-sources</li>
<li>process-tset-sources</li>
<li>generate-test-resources</li>
<li>process-test-resources</li>
<li>test-complite</li>
<li>process-test-classes</li>
<li>test  执行测试用例</li>
<li>prepare-package</li>
<li>package  创建项目jar/war包</li>
<li>pre-integration-test</li>
<li>integration-test</li>
<li>post-integration-test</li>
<li>vrify</li>
<li>install  将项目输出构件安装到本地仓库</li>
<li>deploy  将项目输出构件部署到远程仓库</li>
</ul>
</li>
<li>site，建立站点
<ul>
<li>pre-site</li>
<li>site</li>
<li>post-site</li>
<li>site-deploy</li>
</ul>
</li>
</ul>
<p>生命周期对应的命令行：</p>
<pre><code class="language-sh">$ mvn clean  
$ mvn test  
$ mvn clean install  
$ mvn clean deploy site-deploy
</code></pre>
<p>maven生命周期所做的事由插件完成。</p>
<h1 id="插件">插件</h1>
<h2 id="todo">TODO..</h2>
<h2 id="常用插件-code-snippets">常用插件 code snippets</h2>
<ul>
<li>指定编译、打包的 JDK 版本</li>
</ul>
<pre><code class="language-xml">    &lt;build&gt;
        &lt;plugins&gt;
            &lt;!--指定编译的Java版本--&gt;
            &lt;plugin&gt;
                &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
                &lt;configuration&gt;
                    &lt;source&gt;1.8&lt;/source&gt;
                    &lt;target&gt;1.8&lt;/target&gt;
                &lt;/configuration&gt;
            &lt;/plugin&gt;
        &lt;/plugins&gt;
    &lt;/build&gt;
</code></pre>
<ul>
<li>跳过所有测试</li>
</ul>
<pre><code class="language-xml">  &lt;build&gt;
    &lt;plugins&gt;
      &lt;plugin&gt;
        &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
        &lt;artifactId&gt;maven-surefire-plugin&lt;/artifactId&gt;
        &lt;version&gt;2.5&lt;/version&gt;
        &lt;!--跳过所有的测试--&gt;
        &lt;configuration&gt;
          &lt;skipTests&gt;true&lt;/skipTests&gt;
        &lt;/configuration&gt;
      &lt;/plugin&gt;
    &lt;/plugins&gt;
  &lt;/build&gt;
</code></pre>
<h1 id="聚合与继承">聚合与继承</h1>
<h2 id="聚合">聚合</h2>
<p>首先要明白聚合的目的是<strong>分模块，方便快速构建应用</strong>。</p>
<p>聚合主要是<code>packaging</code>和<code>modules</code>元素：</p>
<ul>
<li>packaging的打包方式一定要是pom（默认是jar）</li>
</ul>
<pre><code>&lt;packaging&gt;pom&lt;/packaging&gt;
</code></pre>
<ul>
<li>module是待聚合的项目的artifactId</li>
</ul>
<pre><code>&lt;modules&gt;
    &lt;module&gt;SSM-DAO&lt;/module&gt;
    &lt;module&gt;SSM-Mapper&lt;/module&gt;
    &lt;module&gt;SSM-Template&lt;/module&gt;
&lt;/modules&gt;
</code></pre>
<blockquote>
<p><img src="https://oscimg.oschina.net/oscnet/b2fd1c37d3846da77df003900c8f7e2d269.jpg" alt="maven-module" title="maven-module"></p>
</blockquote>
<p>聚合后，只需运行最外边的pom就可以构建整个项目了。</p>
<h2 id="继承">继承</h2>
<p>首先要明白，继承的目的是为了<strong>简化配置、共用配置</strong>。使用继承的步骤和注意点如下：</p>
<ul>
<li>父pom的<code>packaging</code>打包方式必须是pom</li>
<li>父模块只是为了消除配置的重复，因此它本身不包含除pom之处的项目文件，也就是不需要src/main/java之类的文件</li>
<li>子模块中使用<code>parent</code>元素继承父pom</li>
</ul>
<pre><code>&lt;parent&gt;
    &lt;artifactId&gt;MybatisTest&lt;/artifactId&gt;
    &lt;groupId&gt;com.demo&lt;/groupId&gt;
    &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
    &lt;relativePath&gt;../parent-project/pom.xml&lt;/relativePath&gt;
&lt;/parent&gt;
</code></pre>
<p>注意：在<code>parent</code>元素中可以定义<code>relativePath</code>子元素来指定父pom的位置，如上所示。<code>relativePath</code>默认值是../pom.xml。</p>
<ul>
<li>子模块的<strong>坐标</strong>只需要定义<code>artifactId</code>,不用定义<code>groupId</code>和<code>version</code></li>
</ul>
<p>完整的子模块定义示例如下：</p>
<pre><code>&lt;project xmlns=&quot;http://maven.apache.org/POM/4.0.0&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
         xsi:schemaLocation=&quot;http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd&quot;&gt;
    &lt;parent&gt;
        &lt;artifactId&gt;MybatisTest&lt;/artifactId&gt;
        &lt;groupId&gt;com.demo&lt;/groupId&gt;
        &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
    &lt;/parent&gt;
    &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
    &lt;artifactId&gt;SSM-Test&lt;/artifactId&gt;
    &lt;packaging&gt;war&lt;/packaging&gt;
    &lt;name&gt;SSM-Test Maven Webapp&lt;/name&gt;
    &lt;url&gt;http://maven.apache.org&lt;/url&gt;
    &lt;dependencies&gt;
        &lt;dependency&gt;
            &lt;groupId&gt;javax.servlet&lt;/groupId&gt;
            &lt;artifactId&gt;javax.servlet-api&lt;/artifactId&gt;
            &lt;version&gt;3.1.0&lt;/version&gt;
        &lt;/dependency&gt;
    &lt;/dependencies&gt;
    &lt;build&gt;
        &lt;finalName&gt;SSM-Test&lt;/finalName&gt;
    &lt;/build&gt;
&lt;/project&gt;
</code></pre>
<h3 id="可继承的pom元素">可继承的pom元素</h3>
<ul>
<li>groupId</li>
<li>version</li>
<li>descrption，项目描述信息</li>
<li>organization：项目的组织信息</li>
<li>inceptionYear：项目他妈年份</li>
<li>url：项目url地址</li>
<li>developers：项目开发者信息</li>
<li>contributors：项目贡献者信息</li>
<li>distributionManagement：项目的部署配置</li>
<li>issueManagement：项目的缺陷跟踪系统信息</li>
<li>ciManagement：项目的持续集成系统信息</li>
<li>scm：项目的版本控制信息</li>
<li>mailingLists：项目的邮件列表信息</li>
<li>properties：自定义的maven属性</li>
<li>dependencies：项目依赖配置</li>
<li>dependencyManagement：项目依赖管理配置</li>
<li>repositories：项目的仓库配置</li>
<li>build：包括项目的源码目录配置、输入目录配置、插件配置、插件管理配置等</li>
<li>reporting：包括项目的输入目录配置、报告插件配置等</li>
</ul>
<h3 id="继承中的依赖管理">继承中的依赖管理</h3>
<p><strong>问题</strong>：上面使用<code>dependencies</code>元素时，子模块会完全继承父模块的一切可以继承的依赖，这样不太合理，因为并不是所有的子模块都完全需要父类的依赖。<br>
<strong>解决办法</strong>:父模块使用<code>dependencyManagement</code>元素来包裹<code>dependencies</code>元素，子模块在<code>dependencies</code>元素中声明要继承父模块的依赖，但不用指定版本，即只需定义<code>groupId</code>和<code>artifactId</code>，不用定义<code>version</code>。这样做的好处是版本统一。</p>
<p>父pom的示例：</p>
<pre><code>&lt;project &gt;
    ...
    &lt;properties&gt;
        &lt;springframework.version&gt;2.5.6&lt;/springframework.version&gt;
        &lt;junit.version&gt;4.7&lt;/junit.version&gt;
    &lt;/properties&gt;
    &lt;dependencyManagement&gt;
        &lt;dependencies&gt;
            &lt;dependency&gt;
                &lt;groupId&gt;org.springframework&lt;/groupId&gt;
                &lt;artifactId&gt;spring-core&lt;/artifactId&gt;
                &lt;version&gt;${springframework.version}&lt;/version&gt;
            &lt;/dependency&gt;
            &lt;dependency&gt;
                &lt;groupId&gt;org.springframework&lt;/groupId&gt;
                &lt;artifactId&gt;spring-beans&lt;/artifactId&gt;
                &lt;version&gt;${springframework.version}&lt;/version&gt;
            &lt;/dependency&gt;
        &lt;/dependencies&gt;
    &lt;/dependencyManagement&gt;
&lt;/project&gt;
</code></pre>
<p>子pom的示例：</p>
<pre><code>&lt;project &gt;
    ...
    &lt;dependencies&gt;
        &lt;dependency&gt;
            &lt;groupId&gt;org.springframework&lt;/groupId&gt;
            &lt;artifactId&gt;spring-core&lt;/artifactId&gt;        
        &lt;/dependency&gt;
        &lt;dependency&gt;
            &lt;groupId&gt;org.springframework&lt;/groupId&gt;
            &lt;artifactId&gt;spring-beans&lt;/artifactId&gt;           
        &lt;/dependency&gt;
    &lt;/dependencies&gt;
&lt;/project&gt;
</code></pre>
<p>当然了，子模块完全可以定义自己的依赖。</p>
<h3 id="继承中的插件管理">继承中的插件管理</h3>
<p><strong>问题</strong>：子模块和父模块需要同样的插件时，如何管理插件？<br>
<strong>解决办法</strong>:父模块使用<code>pluginManagement</code>元素来包裹<code>plugins</code>元素，子模块在<code>plugins</code>元素中声明要继承父模块的插件，但不用指定版本，即只需定义<code>groupId</code>和<code>artifactId</code>，不用定义<code>version</code>。这样做的好处是版本统一。</p>
<p>父pom插件示例：</p>
<pre><code class="language-xml">    &lt;build&gt;
        &lt;pluginManagement&gt;
            &lt;plugins&gt;
                &lt;plugin&gt;
                    &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                    &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
                    &lt;configuration&gt;
                        &lt;source&gt;1.5&lt;/source&gt;
                        &lt;target&gt;1.5&lt;/target&gt;
                    &lt;/configuration&gt;
                &lt;/plugin&gt;
                &lt;plugin&gt;
                    &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                    &lt;artifactId&gt;maven-resources-plugin&lt;/artifactId&gt;
                    &lt;configuration&gt;
                        &lt;encoding&gt;UTF-8&lt;/encoding&gt;
                    &lt;/configuration&gt;
                &lt;/plugin&gt;
            &lt;/plugins&gt;
        &lt;/pluginManagement&gt;
    &lt;/build&gt;
</code></pre>
<p>子pom插件示例：</p>
<pre><code class="language-xml">    &lt;build&gt;
        &lt;plugins&gt;
            &lt;plugin&gt;
                &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                &lt;artifactId&gt;maven-source-plugin&lt;/artifactId&gt;
            &lt;/plugin&gt;
        &lt;/plugins&gt;
    &lt;/build&gt;
</code></pre>
<p>子pom中的插件，只有<code>groupId</code>和<code>artifactId</code>与父pom的一致才会继承父pom的插件，否则将是子pom所特有的。</p>
<h2 id="聚合与继承的关系">聚合与继承的关系</h2>
<p><img src="https://oscimg.oschina.net/oscnet/129a49fbe8c40f33111e17333d29097fd77.jpg" alt="aggregation-extends" title="aggregation-extends"></p>
<p>其实它们之间没有什么关系，如果非要说有什么共同点，那么它们的<code>packaging</code>必须是pom。</p>
<p>另外，读者往往发现一个pom既是聚合pom，又是父pom，这么做其实是为了方便。（IntelliJ里面就是这样做）</p>
<h2 id="约定优于配置">约定优于配置</h2>
<blockquote>
<p>任何一个maven项目都隐式地继承超级POM。</p>
</blockquote>
<ul>
<li>maven3，超级pom在 $ MAVEN_HOME/lib/maven-model-builder-x.x.x.jar中的org/apache/maven/model/pom-4.0.0.xml。</li>
<li>maven2，超级pom在 $ MAVEN_HOME/lib/maven-x.x.x-uber.jar中的org/apache/maven/project/pom-4.0.0.xml。</li>
</ul>
<p>超级pom中定义了仓库及插件的仓库，地址都是<a href="http://repo1.maven.org/maven2">http://repo1.maven.org/maven2</a>，并且都关闭了SNAPSHOT的支持，这就是为什么maven默认就可以按需要从中央仓库下载插件的原因。</p>
<p>超级pom中定义了项目的主输入目录、主代码输出目录、最终构件的名称格式、测试代码输出目录、主源码目录、测试源码目录、主资源目录和测试目录。</p>
<h1 id="单元测试">单元测试</h1>
<p>在maven的生命周期中，test阶段与maven-surefire-plugin插件绑定。</p>
<p>maven构建项目时，默认会执行所有的单元测试（以Test结尾的类），那如何跳过全部/部分测试类，或指定特定的测试类呢？</p>
<ul>
<li>
<p>命令方式</p>
<ul>
<li>$ mvn package-DskipTests  跳过所有的测试</li>
<li>$ mvn package-Dmaven.test.skip=true 跳过测试，并跳过测试代码的编译</li>
</ul>
</li>
<li>
<p>pom配置插件方式</p>
</li>
</ul>
<pre><code>    - 跳过所有测试  
  &lt;build&gt;
    &lt;plugins&gt;
      &lt;plugin&gt;
        &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
        &lt;artifactId&gt;maven-surefire-plugin&lt;/artifactId&gt;
        &lt;version&gt;2.5&lt;/version&gt;
        &lt;!--跳过所有的测试--&gt;
        &lt;configuration&gt;
          &lt;skipTests&gt;true&lt;/skipTests&gt;
        &lt;/configuration&gt;
      &lt;/plugin&gt;
    &lt;/plugins&gt;
  &lt;/build&gt;
</code></pre>
<pre><code>   - 跳过测试，并跳过测试代码的编译 
  &lt;build&gt;
    &lt;plugins&gt;
      &lt;plugin&gt;
        &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
        &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
        &lt;version&gt;3.0&lt;/version&gt;
        &lt;configuration&gt;
          &lt;skip&gt;true&lt;/skip&gt;
        &lt;/configuration&gt;
      &lt;/plugin&gt;
      &lt;plugin&gt;
        &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
        &lt;artifactId&gt;maven-surefire-plugin&lt;/artifactId&gt;
        &lt;version&gt;2.5&lt;/version&gt;
        &lt;configuration&gt;
          &lt;skip&gt;true&lt;/skip&gt;
        &lt;/configuration&gt;
      &lt;/plugin&gt;
    &lt;/plugins&gt;
  &lt;/build&gt;
</code></pre>
<pre><code>    - 排除测试类
  &lt;build&gt;
    &lt;plugins&gt;
      &lt;plugin&gt;
        &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
        &lt;artifactId&gt;maven-surefire-plugin&lt;/artifactId&gt;
        &lt;version&gt;2.5&lt;/version&gt;
        &lt;configuration&gt;
          &lt;excludes&gt;
            &lt;exclude&gt;**/*ServiceTest.java&lt;/exclude&gt;
            &lt;exclude&gt;**/TempDaoTest.java&lt;/exclude&gt;
          &lt;/excludes&gt;
        &lt;/configuration&gt;
      &lt;/plugin&gt;
    &lt;/plugins&gt;
  &lt;/build&gt;
</code></pre>
<pre><code>    - 包含以Tests结尾的测试类
  &lt;build&gt;
    &lt;plugins&gt;
      &lt;plugin&gt;
        &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
        &lt;artifactId&gt;maven-surefire-plugin&lt;/artifactId&gt;
        &lt;version&gt;2.5&lt;/version&gt;
        &lt;configuration&gt;
          &lt;includes&gt;
            &lt;include&gt;**/*Tests.java&lt;/include&gt;
          &lt;/includes&gt;
        &lt;/configuration&gt;
      &lt;/plugin&gt;
    &lt;/plugins&gt;
  &lt;/build&gt;
</code></pre>
<ul>
<li>测试报告<br>
使用maven-surefire-plugin插件时默认的测试报告在target/surefire-reports目录，包含两种错误格式的报告：
<ul>
<li>简单文本格式</li>
<li>与junit兼容的xml格式</li>
</ul>
</li>
<li>测试测试覆盖率报告<br>
集成cobertura-maven-plugin插件</li>
<li>重用测试代码<br>
使用 maven-jar-plugin将测试类打包：</li>
</ul>
<pre><code>  &lt;build&gt;
    &lt;plugins&gt;
      &lt;plugin&gt;
        &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
        &lt;artifactId&gt;maven-jar-plugin&lt;/artifactId&gt;
        &lt;version&gt;3.0.2&lt;/version&gt;
        &lt;executions&gt;
          &lt;execution&gt;
            &lt;goals&gt;
              &lt;goal&gt;test-jar&lt;/goal&gt;
            &lt;/goals&gt;
          &lt;/execution&gt;
        &lt;/executions&gt;
      &lt;/plugin&gt;
    &lt;/plugins&gt;
  &lt;/build&gt;
</code></pre>
<p>maven-jar-plugin有两个目标，分别是jar和test-jar。<br>
1）jar，内置绑定在packaging阶段执行，主要是对项目主代码进行打包<br>
2）test-jar，没有内置绑定，需要显式声明，主要是对项目的测试代码进行打包</p>
<h1 id="web开发">Web开发</h1>
<h2 id="目录结构">目录结构</h2>
<pre><code>+ project  
    |
    + pom.xml  
    |
    + src/
        + main/
        | + java/
        | | + ServletA.java
        | | + ...
        | |
        | + resources/
        | | + config.properties
        | | + ...
        | |
        | + webapp/
        |   +WEB-INF/
        |   | + web.xml
        |   |
        |   + img/
        |   |
        |   + css
        |   |
        |   + js
        |   |
        |   + index.jsp
        |   |
        + test/
            + java/
            + resources/
</code></pre>
<ul>
<li>pom</li>
</ul>
<p>几乎所有的web所需的两个依赖：</p>
<pre><code>        &lt;dependency&gt;
            &lt;groupId&gt;javax.servlet&lt;/groupId&gt;
            &lt;artifactId&gt;servlet-api&lt;/artifactId&gt;
            &lt;version&gt;2.4&lt;/version&gt;
            &lt;scope&gt;provided&lt;/scope&gt;
        &lt;/dependency&gt;
        &lt;dependency&gt;
            &lt;groupId&gt;javax.servlet.jsp&lt;/groupId&gt;
            &lt;artifactId&gt;jsp-api&lt;/artifactId&gt;
            &lt;version&gt;2.0&lt;/version&gt;
            &lt;scope&gt;provided&lt;/scope&gt;
        &lt;/dependency&gt;
</code></pre>
<ul>
<li>指定打包的名字</li>
</ul>
<pre><code>    &lt;build&gt;
        &lt;finalName&gt;SSM-Test&lt;/finalName&gt;
    &lt;/build&gt;
</code></pre>
<p>打包的名字就是 SSM-Test.war，不配置的话，默认是xxxx-1.0.0-SNAPSHOT.war</p>
<h2 id="-darchetypecataloginternal">-DarchetypeCatalog=internal</h2>
<p>添加一个参数，maven构建时不用每次去下载插件</p>
<p><img src="https://gitee.com/rulerLwx/PicGo/raw/master/img-07/20200708124730.png" alt=""></p>
<h2 id="jetty-maven-plugin">jetty-maven-plugin</h2>
<p>web页面的测试应该仅限于页面层次，如jps/css/javascript的修改，其它代码修改（如数据库访问），请编写单元测试。</p>
<p>通常情况下，我们只需要直接在IDE中修改源码，IDE能够执行自动编译，jetty-maven-plugin发现编译后的文件变化后，自动将其更新到jetty容器，这时就可以直接测试web页面了。</p>
<p>使用步骤如下：</p>
<ul>
<li>在pom中配置</li>
</ul>
<pre><code class="language-xml">    &lt;build&gt;
        &lt;pluginManagement&gt;
            &lt;plugins&gt;
                &lt;plugin&gt;
                    &lt;groupId&gt;org.mortbay.jetty&lt;/groupId&gt;
                    &lt;artifactId&gt;jetty-maven-plugin&lt;/artifactId&gt;
                    &lt;version&gt;7.1.6.v20100715&lt;/version&gt;
                    &lt;configuration&gt;
                        &lt;scanIntervalSeconds&gt;10&lt;/scanIntervalSeconds&gt;
                        &lt;webAppConfig&gt;
                            &lt;contextPath&gt;/account&lt;/contextPath&gt;
                        &lt;/webAppConfig&gt;
                    &lt;/configuration&gt;
                &lt;/plugin&gt;
            &lt;/plugins&gt;
        &lt;/pluginManagement&gt;
    &lt;/build&gt;
</code></pre>
<p><em>注意</em>：这个jetty-maven-plugin并不是官方插件，
scanIntervalSeconds，表示隔多少秒扫描一次；
contextPath，表示context path,例如 http://hostname:port/account/</p>
<ul>
<li>修改setting.xml文件</li>
</ul>
<pre><code>&lt;settings&gt;
    ....
    &lt;pluginGroup&gt;org.mortbay.jetty&lt;/pluginGroup&gt;
    ....
&lt;/setting&gt;
</code></pre>
<ul>
<li>启动</li>
</ul>
<pre><code class="language-bash">$ mvn jetty:run

$ mvn jetty:run -Djetty.port=9999   指定了端口
</code></pre>
<p><strong>注意</strong>：在intellij中，通过Maven Project视图中的Run Configurations来配置执行的命令</p>
<h1 id="私服nexus">私服：Nexus</h1>
<blockquote>
<p>Nexus是典型的JavaWeb项目，它有两种安装包，一种是包含Jetty窗口的Buddle包，另一种是不包含web容器的war包。</p>
</blockquote>
<p>Nexus分开源版本和专业版本，专业版本收费。</p>
<p>搭建私服：</p>
<p>1）下载</p>
<p><a href="http://www.sonatype.org/nexus/downloads/">http://www.sonatype.org/nexus/downloads/</a></p>
<p>2）安装</p>
<ul>
<li>
<p>实验用版本：nexus-2.14.1-01-bundle（windows)</p>
</li>
<li>
<p>解压，目录结构如下</p>
<p><img src="https://oscimg.oschina.net/oscnet/0877fb0fba9a6324b232908ac9c7b2ccc23.jpg" alt="maven-nexus-unzip" title="maven-nexus-unzip"></p>
</li>
<li>
<p>以管理员身份启动dos窗口，cd进入解压后的nexus-2.14.1-01-bundle\nexus-2.14.1-01\bin目录，执行以下命令：</p>
</li>
</ul>
<pre><code class="language-sh">  &gt; nexus install
</code></pre>
<p>此命令是把nexus安装成windows的服务，如果不想安装此服务，可以执行<code>&gt;nexus uninstall</code>。</p>
<ul>
<li>到windows服务列表窗口启动<code>nexus</code>服务。</li>
<li>启动服务报错了？？？？？TODO&hellip;.</li>
</ul>
<h1 id="faq">FAQ</h1>
<h2 id="omitted-for-duplicate依赖冲突">omitted for duplicate（依赖冲突）</h2>
<pre><code class="language-xml">&lt;dependency&gt;
    &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
    &lt;artifactId&gt;spring-boot-devtools&lt;/artifactId&gt;
    &lt;exclusions&gt;
        &lt;exclusion&gt;
            &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;//产生omitted for duplicate的依赖的ja对应的g
            &lt;artifactId&gt;spring-boot&lt;/artifactId&gt;//产生omitted for duplicate的依赖jar对应的a
        &lt;/exclusion&gt;
        &lt;exclusion&gt;
            &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
            &lt;artifactId&gt;spring-boot-autoconfigure&lt;/artifactId&gt;
        &lt;/exclusion&gt;
    &lt;/exclusions&gt;
&lt;/dependency&gt;
</code></pre>
<p><a href="http://www.cnblogs.com/brxHqs/p/10307787.html">http://www.cnblogs.com/brxHqs/p/10307787.html</a></p>
<h1 id="附件">附件</h1>
<h2 id="pomxml-最简配置">pom.xml 最简配置</h2>
<pre><code class="language-pom">&lt;project xmlns=&quot;http://maven.apache.org/POM/4.0.0&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
  xsi:schemaLocation=&quot;http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd&quot;&gt;
  &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;

  &lt;groupId&gt;com.demo&lt;/groupId&gt;
  &lt;artifactId&gt;mybatis&lt;/artifactId&gt;
  &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;

  &lt;packaging&gt;jar&lt;/packaging&gt;

  &lt;name&gt;mybatis&lt;/name&gt;
  &lt;url&gt;http://maven.apache.org&lt;/url&gt;

  &lt;properties&gt;
    &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
  &lt;/properties&gt;

  &lt;dependencies&gt;
  &lt;/dependencies&gt;

&lt;/project&gt;

</code></pre>
<h2 id="ssm常用依赖">SSM常用依赖</h2>
<ul>
<li>hibernate-validator</li>
</ul>
<pre><code class="language-xml">    &lt;dependency&gt;
        &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
        &lt;artifactId&gt;hibernate-validator&lt;/artifactId&gt;
        &lt;version&gt;5.3.5.Final&lt;/version&gt;
    &lt;/dependency&gt;
</code></pre>
<h2 id="国内镜像">国内镜像</h2>
<p>在setting.xml文件配置。</p>
<pre><code class="language-xml">&lt;mirrors&gt;
    &lt;mirror&gt;
        &lt;id&gt;alimaven&lt;/id&gt;
        &lt;name&gt;aliyun maven&lt;/name&gt;
        &lt;url&gt;http://maven.aliyun.com/nexus/content/groups/public/&lt;/url&gt;
        &lt;mirrorOf&gt;central&lt;/mirrorOf&gt;
    &lt;/mirror&gt;
    &lt;mirror&gt;
        &lt;id&gt;central&lt;/id&gt;
        &lt;name&gt;Maven Repository Switchboard&lt;/name&gt;
        &lt;url&gt;http://repo1.maven.org/maven2/&lt;/url&gt;
        &lt;mirrorOf&gt;central&lt;/mirrorOf&gt;
    &lt;/mirror&gt;
    &lt;mirror&gt;
        &lt;id&gt;repo2&lt;/id&gt;
        &lt;mirrorOf&gt;central&lt;/mirrorOf&gt;
        &lt;name&gt;Human Readable Name for this Mirror.&lt;/name&gt;
        &lt;url&gt;http://repo2.maven.org/maven2/&lt;/url&gt;
    &lt;/mirror&gt;
    &lt;mirror&gt;
        &lt;id&gt;ibiblio&lt;/id&gt;
        &lt;mirrorOf&gt;central&lt;/mirrorOf&gt;
        &lt;name&gt;Human Readable Name for this Mirror.&lt;/name&gt;
        &lt;url&gt;http://mirrors.ibiblio.org/pub/mirrors/maven2/&lt;/url&gt;
    &lt;/mirror&gt;
    &lt;mirror&gt;
        &lt;id&gt;jboss-public-repository-group&lt;/id&gt;
        &lt;mirrorOf&gt;central&lt;/mirrorOf&gt;
        &lt;name&gt;JBoss Public Repository Group&lt;/name&gt;
        &lt;url&gt;http://repository.jboss.org/nexus/content/groups/public&lt;/url&gt;
    &lt;/mirror&gt;
    &lt;!-- 中央仓库在中国的镜像 --&gt;
    &lt;mirror&gt;
        &lt;id&gt;maven.net.cn&lt;/id&gt;
        &lt;name&gt;oneof the central mirrors in china&lt;/name&gt;
        &lt;url&gt;http://maven.net.cn/content/groups/public/&lt;/url&gt;
        &lt;mirrorOf&gt;central&lt;/mirrorOf&gt;
    &lt;/mirror&gt;
&lt;/mirrors&gt;
</code></pre>

    </div>
    <div class="article-footer">
<blockquote class="mt-2x">
  <ul class="post-copyright list-unstyled">
    <li class="post-copyright-link hidden-xs">
      <strong>Permalink: </strong>
      <a href="https://rulerLwx.gitee.io/2020/07/java-tool-maven-1/" title="Java-tool-Maven-1" target="_blank" rel="external">https://rulerLwx.gitee.io/2020/07/java-tool-maven-1/</a>
    </li>
    <li class="post-copyright-license">
      <strong>License：</strong><a href="http://creativecommons.org/licenses/by/4.0/deed.zh" target="_blank" rel="external">CC BY 4.0 CN</a>
    </li>
  </ul>
</blockquote>

<div class="panel panel-default panel-badger">
  <div class="panel-body">
    <figure class="media">
      <div class="media-left">
        <a href="https://gitee.com/rulerLwx" target="_blank" class="img-burn thumb-sm visible-lg">
          <img src="https://rulerLwx.gitee.io/avatar.png" class="img-rounded w-full" alt="">
        </a>
      </div>
      <div class="media-body">
        <h3 class="media-heading"><a href="https://gitee.com/rulerLwx" target="_blank"><span class="text-dark">rulerLwx</span><small class="ml-1x">thinking...</small></a></h3>
        <div>Good Good Study, Day Day Up~</div>
      </div>
    </figure>
  </div>
</div>
    </div>
  </article>
<section id="comments">
    <div id="vcomments"></div>
</section>

</div><nav class="bar bar-footer clearfix" data-stick-bottom>
    <div class="bar-inner">
        <ul class="pager pull-left">
            <li class="prev">
                <a href="https://rulerLwx.gitee.io/2020/07/java-tool-maven-2/" title="Java-tool-Maven-2"><i
                        class="icon icon-angle-left"
                        aria-hidden="true"></i><span>&nbsp;&nbsp;Older</span></a>
            </li>
            <li class="next">
                <a href="https://rulerLwx.gitee.io/2020/07/java-senior-%E8%AE%BE%E8%AE%A1%E6%A8%A1%E5%BC%8F/"
                    title="Java-Senior-设计模式"><span>Newer&nbsp;&nbsp;</span><i
                        class="icon icon-angle-right" aria-hidden="true"></i></a>
            </li>
            
            <li class="toggle-toc">
                <a class="toggle-btn collapsed" data-toggle="collapse" href="#collapseToc" aria-expanded="false"
                    title="Catalogue" role="button">
                    <span>[&nbsp;</span><span>Catalogue</span>
                    <i class="text-collapsed icon icon-anchor"></i>
                    <i class="text-in icon icon-close"></i>
                    <span>]</span>
                </a>
            </li>
        </ul>
        <div class="bar-right">
            <div class="share-component" data-sites="weibo,qq,wechat"
                data-mobile-sites="weibo,qq,qzone"></div>
        </div>
    </div>
</nav>

</main><footer class="footer" itemscope itemtype="http://schema.org/WPFooter">
<ul class="social-links">
    <li><a href="https://gitee.com/rulerLwx" target="_blank" title="gitee" data-toggle=tooltip data-placement=top >
            <i class="icon icon-gitee"></i></a></li>
    <li><a href="https://github.com/wolf-lea" target="_blank" title="github" data-toggle=tooltip data-placement=top >
            <i class="icon icon-github"></i></a></li>
</ul>
  <div class="copyright">
    &copy;2020  -
    2020
    <div class="publishby">
        Theme by <a href="https://github.com/xiaoheiAh" target="_blank"> xiaoheiAh </a>base on<a href="https://github.com/xiaoheiAh/hugo-theme-pure" target="_blank"> pure</a>.
    </div>
  </div>
</footer>

<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/MathJax.js?config=TeX-MML-AM_SVG"></script>
<script type="text/x-mathjax-config">
    MathJax.Hub.Config({
            showMathMenu: false, //disables context menu
            tex2jax: {
            inlineMath: [ ['$','$'], ['\\(','\\)'] ]
           }
    });
</script>


<script src="https://cdn.jsdelivr.net/npm/jquery@3.4.1/dist/jquery.min.js"></script>
<script>
    window.jQuery || document.write('<script src="js/jquery.min.js"><\/script>')
</script>
<script type="text/javascript" src="https://cdn.staticfile.org/highlight.js/9.15.10/highlight.min.js"></script>
<script type="text/javascript" src="https://cdn.staticfile.org/highlight.js/9.15.10/languages/python.min.js" defer></script>
<script type="text/javascript" src="https://cdn.staticfile.org/highlight.js/9.15.10/languages/javascript.min.js" defer></script><script>
    hljs.configure({
        tabReplace: '    ', 
        classPrefix: ''     
        
    })
    hljs.initHighlightingOnLoad();
</script>
<script src="https://rulerLwx.gitee.io/js/application.min.bdeb64b910570b6c41badc6a05b7afb0c8ad9efd8525de3c7257d59e786326a3.js"></script>
<script src="https://rulerLwx.gitee.io/js/plugin.min.51ff8c7317566f82259170fa36e09c4493adc9b9378b427a01ad3f017ebac7dd.js"></script>

<script>
    (function (window) {
        var INSIGHT_CONFIG = {
            TRANSLATION: {
                POSTS: 'Posts',
                PAGES: 'Pages',
                CATEGORIES: 'Categories',
                TAGS: 'Tags',
                UNTITLED: '(Untitled)',
            },
            ROOT_URL: 'https:\/\/rulerLwx.gitee.io',
            CONTENT_URL: 'https:\/\/rulerLwx.gitee.io\/searchindex.json ',
        };
        window.INSIGHT_CONFIG = INSIGHT_CONFIG;
    })(window);
</script>
<script type="text/javascript" src="https://rulerLwx.gitee.io/js/insight.min.a343cd9a5a7698336b28ef3a7c16a3a1b1d2d5fb17dc8ed04022bbe08cc5459073a15bdafa3a8a58cdd56080784bdd69fa70b1ae8597565c799c57ed00f0e120.js" defer></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/tocbot/4.4.2/tocbot.min.js"></script>
<script>
    tocbot.init({
        
        tocSelector: '.js-toc',
        
        contentSelector: '.js-toc-content',
        
        headingSelector: 'h1, h2, h3',
        
        hasInnerContainers: true,
    });
</script>

<script src="https://cdn1.lncld.net/static/js/3.0.4/av-min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/valine"></script>
<script type="text/javascript">
    var GUEST = ['nick', 'mail', 'link'];
    var meta = 'nick,mail';
    meta = meta.split(',').filter(function (item) {
        return GUEST.indexOf(item) > -1;
    });
    new Valine({
        el: '#vcomments',
        verify: null ,
        notify: null ,
        appId: 'IyAB0PSPRazTPDxitO1ddQ7O-gzGzoHsz',
        appKey: '5rBJTq4KidYF33eXwvRVhtEH',
        placeholder: 'enjoy~',
        avatar: 'mm',
        meta: meta,
        pageSize: '10' || 10,
        visitor: false 
});
</script>

  </body>
</html>
